package com.sky.controller.admin;

import com.sky.entity.Orders;
import com.sky.result.Result;
import com.sky.service.ReportService;
import com.sky.service.WorkspaceService;
import com.sky.vo.BusinessDataVO;
import com.sky.vo.DishOverViewVO;
import com.sky.vo.OrderOverViewVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;

/**
 * @Title: WorkspaceController
 * @Author 贾金博
 * @Package com.sky.controller.admin
 * @Date 2024/3/31 21:07
 * @description:
 */

@RestController
@RequestMapping("admin/workspace")
@Api("工作台")
@Slf4j

public class WorkspaceController {

    @Autowired
    private ReportService reportService;

    @Autowired
    private WorkspaceService workspaceService;


    /**
     * 查询今日运营数据
     */
    @GetMapping("businessData")
    @ApiOperation("查询今日运营数据")
    public Result<BusinessDataVO>businessData() {
        BusinessDataVO businessDataVO = workspaceService.getBusinessData(LocalDateTime.of(LocalDate.now(), LocalTime.MIN), LocalDateTime.of(LocalDate.now(), LocalTime.MAX));
        return Result.success(businessDataVO);
    }


    /**
     * 查询套餐总览
     * @return
     */
    @GetMapping("overviewDishes")
    @ApiOperation("查询套餐总览")
    public Result<DishOverViewVO> overviewDishes() {
        DishOverViewVO dishOverViewVO = workspaceService.overviewDishes();
        return Result.success(dishOverViewVO);
    }

    /**
     * 查询套餐总览
     * @return
     */
    @GetMapping("overviewSetmeals")
    @ApiOperation("查询套餐总览")
    public Result<DishOverViewVO> overviewSetmeals() {
        DishOverViewVO dishOverViewVO = workspaceService.overviewSetmeals();
        return Result.success(dishOverViewVO);
    }

    /**
     * 查询订单管理数据
     * @return
     */
    @GetMapping("overviewOrders")
    @ApiOperation("查询订单管理数据")
    public Result<OrderOverViewVO>overviewOrders() {
        OrderOverViewVO orderOverViewVO = workspaceService.overviewOrders();
        return Result.success(orderOverViewVO);
    }
}
